package ivansalvadori.diariopushweb.view;

import ivansalvadori.diariopushweb.view.comoFunciona.ComoFunciona;
import ivansalvadori.diariopushweb.view.security.AuthStrategy;
import ivansalvadori.diariopushweb.view.security.LoginPage;
import ivansalvadori.diariopushweb.view.security.MySession;
import ivansalvadori.diariopushweb.view.termo.GerenciadorTermo;
import ivansalvadori.diariopushweb.view.usuario.insert.InserirUsuario;

import org.apache.wicket.Session;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Response;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;

public class WicketApplication extends WebApplication {
	/**
	 * @see org.apache.wicket.Application#getHomePage()
	 */
	@Override
	public Class<HomePage> getHomePage() {
		return HomePage.class;
	}

	/**
	 * @see org.apache.wicket.Application#init()
	 */
	@Override
	public void init() {
		super.init();

		mountPage("login", LoginPage.class);
		mountPage("cadastro", InserirUsuario.class);
		mountPage("home", GerenciadorTermo.class);
		mountPage("comoFunciona", ComoFunciona.class);


		getComponentInstantiationListeners().add(
				new SpringComponentInjector(this));



		getApplicationSettings().setPageExpiredErrorPage(HomePage.class);

		// add your configuration here

		getSecuritySettings().setAuthorizationStrategy(new AuthStrategy());

	}

	@Override
	public Session newSession(Request request, Response response) {
		return new MySession(request);
	}

}
